package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.domain.ClassQueryParam;
import com.itheima.domain.PageResult;
import com.itheima.domain.pojo.OperateLog;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.service.LogSelectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogSelectSeviceImpl implements LogSelectService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageResult pageLogs(ClassQueryParam queryParam) {
        //开启分页
        PageHelper.startPage(queryParam.getPage(), queryParam.getPageSize());

        Page<OperateLog> p = operateLogMapper.selectPageLog(queryParam);
        return new PageResult<>(p.getTotal(), p.getResult());
    }
}
